package com.duowei.dw_pos.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.duowei.dw_pos.R;
import com.duowei.dw_pos.bean.DMFKFS;

import java.util.List;

public class OtherPayDetailAdapter extends BaseAdapter {
    private List<DMFKFS> mList;
    private final LayoutInflater mInflater;

    public OtherPayDetailAdapter(Context context,List<DMFKFS> list) {
        mInflater = LayoutInflater.from(context);
        mList = list;
    }

    public void setList(List<DMFKFS> list) {
        mList = list;
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup viewGroup) {
        ViewHold hold;
        if(convertView==null){
            convertView = mInflater.inflate(R.layout.otherpaydetail_item, null);
            hold=new ViewHold();
            hold.tvName= (TextView) convertView.findViewById(R.id.tv_name);
            hold.tvMoney= (TextView) convertView.findViewById(R.id.tv_money);
            convertView.setTag(hold);
        }else{
            hold= (ViewHold) convertView.getTag();
        }
        hold.tvName.setText(mList.get(position).getNr());
        hold.tvMoney.setText("￥"+mList.get(position).getMoney());
        return convertView;
    }
    class ViewHold{
        public TextView tvName;
        public TextView tvMoney;
    }
}
